﻿@model List<LeEdu.MODEL.Exam>
@{
    Layout = null;
}

<!DOCTYPE html>

<html>
<head>
    <!-- 网页头部分布视图 -->
    @Html.Partial("~/Views/Shared/HouTai_Header.cshtml")
    <meta name="viewport" content="width=device-width" />
    <title>Exammba</title>

    <link href="~/Content/css/bootstrap.css" rel="stylesheet" />
    <link href="~/Content/css/common.css" rel="stylesheet" />
    <link href="~/Content/css/font-awesome.min.css" rel="stylesheet" />
    <link href="~/Content/css/es-icon.css" rel="stylesheet" />
    <link href="~/Content/css/main.css" rel="stylesheet" />
    <script src="~/Content/js/jquery.min.js"></script>
    <script>
        function jumpMenu(e) {
            window.location.href = e.value;//使用js执行跳转（window.location.href）
        }
    </script>
    <script>
        $(document).ready(function () {
            $("#qx").click(function () {
                if ($("#qx").attr('checked',true))
                {
                    $("input[name='items']").each(function () {
                        $(this).attr('checked',true);
                    })
                }
                else
                {
                    $("input[name='items']").each(function () {

                        $(this).attr('checked',false);
                    })
                }
            });
        });
    </script>
</head>
<body>
    <!-- 网页导航菜单分布视图 -->
    @Html.Partial("~/Views/Shared/HouTai_DaoHang.cshtml")
    <!-- 网页左侧菜单分布视图 -->
    @Html.Partial("~/Views/Shared/CouseCreateManage_Menu_Left.cshtml")
    <div class="col-md-9">
        <div class="panel panel-default panel-col">
            <div class="panel-heading">
                <a href="/Course/Exam" class="btn btn-info btn-sm pull-right mls"><span class="glyphicon glyphicon-plus"></span>创建试卷</a>
                试卷管理
            </div>
            <div class="panel-body " id="quiz-table-container">
                <table class="table table-striped table-hover" id="quiz-table">
                    <thead>
                        <tr>
                            <th></th>
                            <th width="38%">名称</th>
                            <th>状态</th>
                            <th>题目统计</th>
                            <th>时间限制</th>
                            <th>更新人/时间</th>
                            <th>操作</th>
                        </tr>
                    </thead>
                    <tbody>
                        @foreach (var item in Model)
                        {
                            string sta = "";
                            if (@item.PubState == 0)
                            {
                                sta = "未发布";
                            }
                            else if (@item.PubState == 1)
                            {
                                sta = "已发布";
                            }
                            <tr data-role="item">
                                <td><input id="qx1" name="items" data-role="batch-item" type="checkbox"></td>
                                <td><a href="/test/8/preview" target="_blank">@item.ExamName</a></td>
                                <td>@(item.PubState == 0 ? "未发布" : "已发布")</td>
                                <td>@item.queber 题<span class="text-muted">/</span>@item.Score 分</td>
                                <td>@item.LimitedTime/分钟</td>
                                <td>
                                    <a class="link-dark " href="/user/4">
                                        @{
                            LeEdu.BLL.UserInfoBLL u = new LeEdu.BLL.UserInfoBLL();
                            List<LeEdu.MODEL.UserInfo> list = u.getEntityList(p => true).Where(p => p.UserInfoId == @item.UserInfoId).ToList();
                                        }
                                        @foreach (var a in list)
                                        {
                                            @a.Uname
                                        }
                                    </a><br>
                                    <span class="text-muted text-sm">@item.PubTime</span>
                                </td>
                                <td>
                                    <div class="btn-group">
                                        <a href="/Course/Exampreview/@item.ExamID" class="btn btn-default btn-sm" target="_blank">预览</a>
                                        <a href="#" type="button" class="btn btn-default btn-sm dropdown-toggle" data-toggle="dropdown">
                                            <span class="caret"></span>
                                        </a>
                                        <ul class="dropdown-menu pull-right" onchange="jumpMenu(this)">
                                            <li>
                                                @if (@sta == "已发布")
                                                {
                                                    <a href="/Course/EditState/@item.ExamID">
                                                        <span>取消发布</span>
                                                    </a>
                                                }

                                                @if (@sta == "未发布")
                                                {
                                                    <a href="/Course/EditState/@item.ExamID">
                                                        <span>发布</span>
                                                    </a>
                                                }
                                            </li>

                                            <li><a href="/Course/EditExam/"><span class="glyphicon glyphicon-edit"></span> 编辑试卷信息</a></li>
                                            <li><a href="/course/157/manage/testpaper/8/items"><span class="glyphicon glyphicon-list"></span> 管理题目</a></li>
                                            <li><a href="/Course/ExamDelete/@item.ExamID" data-name="试卷" data-role="item-delete" data-url="/Course/ExamDelete/@item.ExamID"><span class="glyphicon glyphicon-remove-circle"></span> 删除试卷</a></li>
                                        </ul>
                                    </div>
                                </td>
                            </tr>
                        }
                    </tbody>
                </table>
                <div>
                    <label class="checkbox-inline"><input id="qx" data-role="batch-select" type="checkbox"> 全选</label>
                    <button class="btn btn-default btn-sm mlm" data-role="batch-delete" data-name="试卷">删除</button>
                </div>

                <div class="text-muted mtl">提示：只有已发布的试卷才能被添加到课程中去，试卷一旦发布后将不能修改。</div>

            </div>
        </div>
    </div>
</body>
</html>
